package com.tool.emulator.mos6502;

/**
 * Resiters.java @author tl 2011-6-19
 */
public class DefaultRegisters extends Registers {
	private int AC;//累加器
	private int XR;//X寄存器
	private int YR;//Y寄存器
	private int IR;//中断 RESET/NMI/IRQ
	private int SP;//堆栈寄存器 堆栈地址=  SP + 0x100
	private int PC;//16位 程序指针

	//状态寄存器的状态位，为了模拟方便，分开定义
	private boolean N;//负数
	private boolean V;//溢出
	private boolean B;//BRK软中断
	private boolean D;//十进制
	private boolean I;//终端屏蔽
	private boolean Z;//零
	private boolean C;//进位

	public DefaultRegisters() {

	}

	public DefaultRegisters(Registers srcValues) {
		this();
		if (srcValues != null)
			this.setValues(srcValues);
	}

	public int getAC() {
		return AC;
	}

	public int setAC(int aC) {
		return (AC = aC & 0xff);
	}

	public int getXR() {
		return XR;
	}

	public int setXR(int xR) {
		return (XR = xR & 0xff);
	}

	public int getYR() {
		return YR;
	}

	public int setYR(int yR) {
		return (YR = yR & 0xff);
	}

	public int getIR() {
		return IR;
	}

	public void setIR(int iR) {
		IR = iR;
	}

	public int getSP() {
		return SP;
	}

	public int setSP(int sP) {
		return (SP = sP & 0xff);
	}

	public int getPC() {
		return PC;
	}

	public void setPC(int pC) {
		PC = pC & 0xffff;
	}

	public boolean isN() {
		return N;
	}

	public void setN(boolean n) {
		N = n;
	}

	public boolean isV() {
		return V;
	}

	public void setV(boolean v) {
		V = v;
	}

	public boolean isB() {
		return B;
	}

	public void setB(boolean b) {
		B = b;
	}

	public boolean isD() {
		return D;
	}

	public void setD(boolean d) {
		D = d;
	}

	public boolean isI() {
		return I;
	}

	public void setI(boolean i) {
		I = i;
	}

	public boolean isZ() {
		return Z;
	}

	public void setZ(boolean z) {
		Z = z;
	}

	public boolean isC() {
		return C;
	}

	public void setC(boolean c) {
		C = c;
	}
}
